package com.hk.controller.admin;

import com.hk.model.dto.CourseSubjectDto;
import com.hk.model.pojo.CourseSubject;
import com.hk.model.pojo.Curriculum;
import com.hk.model.vo.CourseSubject_Vo;
import com.hk.result.PageResult;
import com.hk.result.Result;
import com.hk.service.CurriculumService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/clues/course")
@Api(tags = "课程管理")
public class CurriculumController {
    @Autowired
    private CurriculumService curriculumService;

    @GetMapping("/list")
    public PageResult list(Integer pageNum, Integer pageSize, String  code, String  name, String applicablePerson,Integer params, String beginCreateTime, String endCreateTime, String subject) {
        PageResult curriculumVo = curriculumService.list(pageNum, pageSize, code, name, applicablePerson,params, beginCreateTime, endCreateTime, subject);
        return curriculumVo;
    }

    @PostMapping
    @ApiOperation(value = "添加课程")
    public Result addSubject(@RequestBody Curriculum curriculum) {
        curriculumService.addSubject(curriculum);
        return Result.success(curriculum);
    }

    @GetMapping("/{id}")
    @ApiOperation(value = "根据id回显")
    public Result<Curriculum> seleltId(@PathVariable Integer id) {
        return Result.success(curriculumService.seleltId(id));
    }

    @ApiOperation("批量删除课程")
    @DeleteMapping("/{ids}")
    public Result<String> deleteBatchIds(@PathVariable Integer[] ids) {
        curriculumService.deleteBatchIds(ids);
        return Result.success("删除成功");
    }


}
